/**
 * JAVACC DEMO 1.0
 */
package com.apache.portal.weixin.service;

import com.apache.portal.weixin.core.common.LoadService;
import com.apache.portal.weixin.entity.BaseVo;
import com.apache.portal.weixin.entity.InfoVo;
import com.apache.portal.weixin.entity.recv.WxRecvEventMsg;
import com.apache.portal.weixin.entity.recv.WxRecvMsg;
import com.apache.portal.weixin.entity.send.WxSendMsg;

import java.util.ArrayList;
import java.util.List;

/**
 * description:  图文消息
 *
 * @author dyhou 创建时间：2017-3-2
 */
public class NewsServiceImpl extends AbstractService {

    /**
     * TODO 简单描述该方法的实现功能（可选）.
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    public Object execute(BaseVo vo) throws Exception {
        WxRecvMsg wxRecvMsg = vo.getWxRecvMsg();
        WxRecvEventMsg event = (WxRecvEventMsg) wxRecvMsg;
        WxSendMsg sendMsg = null;
        List<InfoVo> list = new ArrayList<InfoVo>();
        if ("subscribe".equalsIgnoreCase(event.getEvent()) || "subscribe"
                .equals(event.getEventKey())) {//关注时返回多图文列表
            list.add(getInfoVoFromProp("subscribe"));
        } else {

        }
        sendMsg = LoadService.getInstance().getTools().builderSendByRecv(wxRecvMsg);
        sendMsg = getInfos(list, sendMsg);
        return sendMsg;
    }
}
